class StatusServlet < HTTPServlet::AbstractServlet
 

 # handle status display
 # also prune inactive client
 # @param req client request
 # @param rep client reply
 # @return HTTP status
 # \version 1.0
 # \date   Oct 2009
 # \author Elie
 
  def do_GET(req, resp)   
    
    #prune old clients
    pruneClient()
    
    #construct the body
    #get headers
    body = headers("Status", $refresh)
    
    #actual content
    uptime = Time.new() - $start
    #body += '<center>'
    body += '<table>'
    body += '<tr><td><b>Uptime</b></td><td>' + uptime.to_i.to_s + '</td></tr>'
    body += '<tr><td><b>Number of client</b></td><td>' + $clientNum.to_s + '</td></tr>'
    body += '<tr><td><b>Num hash</b></td><td>' + $numHash.to_s + '</td></tr>'
    body += '<tr><td><b>Num hash cracked</b></td><td>' + $numPass.to_s + '</td></tr>'
    body += '<tr><td><b>Hash/s</b></td><td>' + $hashBySec.to_s + '</td></tr>'
    body += '<tr><td><b>keyspace to explore</b></td><td>' + $keyspace.to_s + '</td></tr>'
    body += '<tr><td><b>Jobs todo</b></td><td>' + $jobsNum.to_s + '</td></tr>'
    body += '<tr><td><b>Jobs done</b></td><td>' + $jobsDone.to_s + '</td></tr>'
    body += '</table>'
    #body += '</center>'
    #get footer
    body += footer()
    
    #send it
    resp.body = body
    
      raise HTTPStatus::OK
  end
  alias do_POST do_GET    # let's accept POST request too.
end